//
//  SAIndexCell.m
//  yidiantong
//
//  Created by 黄志刚 on 2020/10/28.
//

#import "SAIndexCell.h"
#import "SAhomeMenuModel.h"

@interface SAIndexCell ()

@property (nonatomic, strong) UIImageView *iconImageV;
@property (nonatomic, strong) UILabel *iconNameLab;

@end

@implementation SAIndexCell
-(instancetype)initWithFrame:(CGRect)frame {
    if(self = [super initWithFrame:frame]) {
        [self initUI];
    }
    return self;
}

-(void)setModel:(SAhomeMenuModel *)model {
    _model = model;
    
    [self.iconImageV sd_setImageWithURL:[NSURL URLWithString:model.icon]];
    self.iconNameLab.text = model.menuName;
}

#pragma mark - initUI
-(void)initUI {
    [self.contentView addSubview:self.iconImageV];
    [self.contentView addSubview:self.iconNameLab];
}

#pragma mark - lazy
-(UIImageView *)iconImageV {
    if (!_iconImageV) {
        _iconImageV = [[UIImageView alloc] initWithFrame:CGRectMake(kScaleNum(17), 0, kScaleNum(47), kScaleNum(47))];
    }
    return _iconImageV;
}

-(UILabel *)iconNameLab {
    if (!_iconNameLab) {
        _iconNameLab = [[UILabel alloc] initWithFrame:CGRectMake(0, kScaleNum(52), kScaleNum(81), kScaleNum(20))];
        _iconNameLab.textColor = kBlackColor;
        _iconNameLab.textAlignment = NSTextAlignmentCenter;
        _iconNameLab.font = kFont(13);
    }
    return _iconNameLab;
}

@end
